package view.admin;

import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JLabel;
import view.AdminPanel;
import controller.ActionEvents.ActionHandler;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import com.jgoodies.forms.factories.DefaultComponentFactory;
import javax.swing.JSeparator;
import javax.swing.ImageIcon;

public class AdminMenu extends JPanel{
	private JButton btnCreateUser;
	private JButton btnEditUser;
	private JButton btnDeleteUser;
	private JLabel lblCreateANew;
	private JLabel lblDeleteAnExisting;
	private JLabel lblEditAnExisting;
	private JLabel lblWelcome;
	private JLabel lblAsAdminYou;
	private JButton btnStatistics;
	private JButton btnLogOut;
	private JLabel lblViewAList;
	private JLabel lblLogOut;
	private ActionHandler actionHandler;
	
	private AdminPanel adminPanel;
	private JLabel lblUsers;
	private JLabel lblStroke1;
	private JLabel lblStroke2;
	private JLabel lblStroke3;
	private JLabel lblStroke4;
	private JLabel lblStroke5;
	
	public AdminMenu(ActionHandler actionHandler)
	{
		setLayout(null);
		setBackground(Color.WHITE);
		setPreferredSize(new Dimension(750, 480));
		
		this.actionHandler = actionHandler;

		btnCreateUser = new JButton("");
		btnCreateUser.setIcon(new ImageIcon(AdminMenu.class.getResource("/Pictures/green/adminCreateUser.png")));
		btnCreateUser.setBounds(82, 195,  61, 61);
		btnCreateUser.setBorderPainted(false);
		btnCreateUser.setContentAreaFilled(false);
		btnCreateUser.addActionListener(actionHandler);
		btnCreateUser.setActionCommand("showCreateUser");
		add(btnCreateUser);
		
		btnEditUser = new JButton("");
		btnEditUser.setIcon(new ImageIcon(AdminMenu.class.getResource("/Pictures/green/adminEditUser.png")));
		btnEditUser.setBounds(334, 195,  61, 61);
		btnEditUser.setBorderPainted(false);
		btnEditUser.setContentAreaFilled(false);
		btnEditUser.addActionListener(actionHandler);
		btnEditUser.setActionCommand("showEditUser");
		add(btnEditUser);
		
		btnDeleteUser = new JButton("");
		btnDeleteUser.setIcon(new ImageIcon(AdminMenu.class.getResource("/Pictures/green/adminDeleteUser.png")));
		btnDeleteUser.setBounds(208, 195, 61, 61);
		btnDeleteUser.setBorderPainted(false);
		btnDeleteUser.setContentAreaFilled(false);
		btnDeleteUser.addActionListener(actionHandler);
		btnDeleteUser.setActionCommand("showDeleteUser");
		add(btnDeleteUser);
		
		btnStatistics = new JButton("");
		btnStatistics.setIcon(new ImageIcon(AdminMenu.class.getResource("/Pictures/green/adminStatistics.png")));
		btnStatistics.addActionListener(actionHandler);
		btnStatistics.setBorderPainted(false);
		btnStatistics.setContentAreaFilled(false);
		btnStatistics.setActionCommand("showAdminStatistics");
		btnStatistics.setBounds(472, 195,  61, 61);
		add(btnStatistics);
		
		btnLogOut = new JButton("");
		btnLogOut.setIcon(new ImageIcon(AdminMenu.class.getResource("/Pictures/green/adminLogOff.png")));
		btnLogOut.setBounds(614, 195,  61, 61);
		btnLogOut.setBorderPainted(false);
		btnLogOut.setContentAreaFilled(false);
		btnLogOut.addActionListener(actionHandler);
		btnLogOut.setActionCommand("showAdminLogOff");
		add(btnLogOut);
		
		lblCreateANew = new JLabel("Create a new user in the system");
		lblCreateANew.setBounds(257, 125, 236, 21);
		add(lblCreateANew);
		
		lblDeleteAnExisting = new JLabel("Delete an existing user");
		lblDeleteAnExisting.setBounds(268, 183, 236, 21);
		add(lblDeleteAnExisting);
		
		lblEditAnExisting = new JLabel("Edit an existing users data");
		lblEditAnExisting.setBounds(268, 235, 236, 21);
		add(lblEditAnExisting);
		
		lblWelcome = new JLabel("Welcome ");
		lblWelcome.setFont(new Font("Lucida Grande", Font.PLAIN, 28));
		lblWelcome.setBounds(327, 24, 130, 36);
		add(lblWelcome);
		
		lblAsAdminYou = new JLabel("As admin you can create, edit and delete users.");
		lblAsAdminYou.setBounds(240, 55, 304, 29);
		lblAsAdminYou.setVisible(false);
		add(lblAsAdminYou);
		
		lblViewAList = new JLabel("View a list over existing users");
		lblViewAList.setBounds(257, 289, 236, 21);
		add(lblViewAList);
		
		lblLogOut = new JLabel("Log out as admin");
		lblLogOut.setBounds(268, 347, 236, 21);
		add(lblLogOut);
		
		lblUsers = new JLabel("");
		lblUsers.setBounds(496, 440, 298, 16);
		add(lblUsers);
		
		lblStroke1 = new JLabel("");
		lblStroke1.setIcon(new ImageIcon(AdminMenu.class.getResource("/Pictures/ux/stroke.png")));
		lblStroke1.setBounds(236, 113, 9, 45);
		add(lblStroke1);
		
		lblStroke2 = new JLabel("");
		lblStroke1.setIcon(new ImageIcon(AdminMenu.class.getResource("/Pictures/ux/stroke.png")));
		lblStroke1.setBounds(236, 216, 9, 45);
		add(lblStroke1);
		
		lblStroke3 = new JLabel("");
		lblStroke1.setIcon(new ImageIcon(AdminMenu.class.getResource("/Pictures/ux/stroke.png")));
		lblStroke1.setBounds(236, 164, 9, 45);
		add(lblStroke1);
		
		lblStroke4 = new JLabel("");
		lblStroke1.setIcon(new ImageIcon(AdminMenu.class.getResource("/Pictures/ux/stroke.png")));
		lblStroke1.setBounds(236, 341, 9, 45);
		add(lblStroke1);
	
		lblStroke5 = new JLabel("");
		lblStroke1.setIcon(new ImageIcon(AdminMenu.class.getResource("/Pictures/ux/stroke.png")));
		lblStroke1.setBounds(236, 281, 9, 45);
		add(lblStroke1);
		
	}

	/**
	 * @return the lblUsers
	 */
	public JLabel getLblUsers() {
		return lblUsers;
	}

	/**
	 * @return the btnCreateUser
	 */
	public JButton getBtnCreateUser() {
		return btnCreateUser;
	}

	/**
	 * @return the btnEditUser
	 */
	public JButton getBtnEditUser() {
		return btnEditUser;
	}

	/**
	 * @return the btnDeleteUser
	 */
	public JButton getBtnDeleteUser() {
		return btnDeleteUser;
	}

	/**
	 * @return the lblCreateANew
	 */
	public JLabel getLblCreateANew() {
		return lblCreateANew;
	}

	/**
	 * @return the lblDeleteAnExisting
	 */
	public JLabel getLblDeleteAnExisting() {
		return lblDeleteAnExisting;
	}

	/**
	 * @return the lblEditAnExisting
	 */
	public JLabel getLblEditAnExisting() {
		return lblEditAnExisting;
	}

	/**
	 * @return the lblAsAdminYou
	 */
	public JLabel getLblAsAdminYou() {
		return lblAsAdminYou;
	}

	/**
	 * @return the btnStatistics
	 */
	public JButton getBtnStatistics() {
		return btnStatistics;
	}

	/**
	 * @return the btnLogOut
	 */
	public JButton getBtnLogOut() {
		return btnLogOut;
	}

	/**
	 * @return the lblViewAList
	 */
	public JLabel getLblViewAList() {
		return lblViewAList;
	}

	/**
	 * @return the lblLogOut
	 */
	public JLabel getLblLogOut() {
		return lblLogOut;
	}

	/**
	 * @return the lblStroke
	 */
	public JLabel getLblStroke() {
		return lblStroke1;
	}

	/**
	 * @return the lblStroke2
	 */
	public JLabel getLblStroke2() {
		return lblStroke2;
	}

	/**
	 * @return the lblStroke3
	 */
	public JLabel getLblStroke3() {
		return lblStroke3;
	}

	/**
	 * @return the lblStroke4
	 */
	public JLabel getLblStroke4() {
		return lblStroke4;
	}

	/**
	 * @return the lblStroke5
	 */
	public JLabel getLblStroke5() {
		return lblStroke5;
	}
}
